package com.project.bean;

import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.List;

public class ProjectBean {
    //项目编号
    private Integer id;
    //项目名称
    private String name;
    //客户名称
    private String customer;
    //项目资金
    private int capital;
    //项目启动日期,默认当前时间
    private LocalDate startDate = LocalDate.now();
    //项目交付日期
    private LocalDate deliverDate ;
    //项目状态,默认开发中
    private String status = "开发中";
    //剩余天数
    private String surplusDay;
    //项目参与人数
    private int personCount;
    //进度集合
    private List<ProgressBean> progressList;

    public ProjectBean() {
    }

    public ProjectBean(String name, String customer, int capital, LocalDate deliverDate) {
        this.name = name;
        this.customer = customer;
        this.capital = capital;
        this.deliverDate = deliverDate;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCustomer() {
        return customer;
    }

    public void setCustomer(String customer) {
        this.customer = customer;
    }

    public int getCapital() {
        return capital;
    }

    public void setCapital(int capital) {
        this.capital = capital;
    }

    public LocalDate getStartDate() {
        return startDate;
    }

    public void setStartDate(LocalDate startDate) {
        this.startDate = startDate;
    }

    public LocalDate getDeliverDate() {
        return deliverDate;
    }

    public void setDeliverDate(LocalDate deliverDate) {
        this.deliverDate = deliverDate;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getSurplusDay() {
        if (this.status.equals("交付使用")) {
            return "已交付";
        }
        Long x = ChronoUnit.DAYS.between(LocalDate.now(), deliverDate);
        this.surplusDay = x + "";
        return surplusDay;
    }

    public int getPersonCount() {
        return personCount;
    }

    public void setPersonCount(int personCount) {
        this.personCount = personCount;
    }

    public List<ProgressBean> getProgressList() {
        return progressList;
    }

    public void setProgressList(List<ProgressBean> progressList) {
        this.progressList = progressList;
    }

    @Override
    public String toString() {
        return "ProjectBean{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", customer='" + customer + '\'' +
                ", capital=" + capital +
                ", startDate=" + startDate +
                ", deliverDate=" + deliverDate +
                ", status='" + status + '\'' +
                ", surplusDay=" + this.getSurplusDay() +
                ", personCount=" + personCount +
                ", progressList=" + progressList +
                "}\n";
    }
}
